package com.rainng.coursesystem.manager.teacher;

import com.rainng.coursesystem.dao.CourseDAO;
import com.rainng.coursesystem.model.entity.CourseEntity;
import org.springframework.stereotype.Component;

import java.util.List;

@Component("teacher_courseManager")
public class CourseManager {
    private final CourseDAO courseDAO;

    public CourseManager(CourseDAO courseDAO) {
        this.courseDAO = courseDAO;
    }

    public List<CourseEntity> listByTeacherId(Integer teacherId) {
        return courseDAO.listByTeacherId(teacherId);
    }

    public CourseEntity getById(Integer id) {
        return courseDAO.get(id);
    }

    public void create(CourseEntity entity) {
        courseDAO.insert(entity);
    }

    public void update(CourseEntity entity) {
        courseDAO.update(entity);
    }

    public void delete(Integer id) {
        courseDAO.delete(id);
    }
}
